﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.BlackApart.Business.Reservations {
    public class ImpClient : IClient {

        #region Properties

        public int Id { get; set; }
        public string PhoneNumber { get; set; }
        public string EMail { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string PersonTitle { get; set; }
        public string PrefferCurrency { get; set; }
        //public string PrefferCurrency { get { return "GBP"; } set { } }
        public string PrefferLanguage { get; set; }
        //public string PrefferLanguage { get { return "en-GB"; } set { } }
        public bool ClientExists { get; set; }

        #endregion

        #region Methods

        public bool Exists() {
            return this.ClientExists;
        }

        public bool Save() {
            bool state =
                this.PhoneNumber.Length > 8
                && this.EMail.IsValidEmail()
                && this.FirstName.Length >= 3
                && !string.IsNullOrEmpty(this.PersonTitle);
            if (state) this.ClientExists = true;
            return state;
        }

        public IClient SearchClientByEmail(string email) {
            if (email == this.EMail)
                return this;
            else return null;
        }

        #endregion

    }
}
